#ifndef NEWCALENDAR_H
#define NEWCALENDAR_H

#include <QWidget>
#include <QWidget>
#include <QList>
#include <QLabel>
#include <QDate>
#include "daywidget.h"
#include "calendaralgorithm.h"

QT_BEGIN_NAMESPACE
namespace Ui { class newCalendar; }
QT_END_NAMESPACE

class newCalendar : public QWidget
{
    Q_OBJECT

public:
    newCalendar(QWidget *parent = nullptr);
    ~newCalendar();

private:
    QList<DayWidget*>   listDayWidget;
    CalendarAlgorithm dg;
    int             nCurYear;
    int             nCurMonth;
    int             nCurDay;

private:
    void putDayExInList();
    void initCalendarProperty();
    void setLabText(QLabel* pLabel, const QString& strText);
    void setYearMonthLabelHint();
    void setCurYearMonth(int nYear, int nMonth, int nDay);
    void setCalendarHint();
    void connectMouseClickSlot();
    QString getDayOfWeek();            //提示左边的信息
private:
    void updateCtrlStyle();

signals:
    void signalSelectDay(bool bSelected, int nYear, int nMonth, int nDay);

public slots:
    void slotMouseClickDay(bool bSelected, int nIndex, int nMonth);

public:
    void setCurrentDateTime(int nYear, int nMonth, int nDay = 1);
    void setDaySelectStatus(int day, bool bSelect, const QString& strText = "" );

protected:
    void paintEvent(QPaintEvent *);

private slots:
    void on_btn_NextMonth_clicked();

    void on_btn_LastMonth_clicked();

private:
    Ui::newCalendar *ui;
};
#endif // NEWCALENDAR_H
